ffi: validate 'void' as parameter type in getFunction and getFunctions#63504
ffi: validate 'void' as parameter type in getFunction and getFunctions#63504Anshikakalpana wants to merge 1 commit into
Conversation
8b78e7a to
58e5f70
Compare
|
No, this is wrong. Don't validate at JS level but within C++ level please. |
455f25e to
06410ff
Compare
Moved validation into the native FFI signature parsing layer in src/ffi/types.cc as suggested. Also removed the temporary JS-side validation. |
06410ff to
618bed6
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63504 +/- ##
==========================================
- Coverage 90.34% 90.33% -0.01%
==========================================
Files 730 730
Lines 234359 234367 +8
Branches 43923 43917 -6
==========================================
+ Hits 211720 211723 +3
- Misses 14361 14373 +12
+ Partials 8278 8271 -7
🚀 New features to boost your workflow:
|
|
CI failures are relevant |
Hi @ShogunPanda, the Jenkins failures are from the old commit |
618bed6 to
43c1eb8
Compare
|
Fixed the Windows failure — DynamicLibrary(null) rejects null on Windows. Now using kernel32.dll on Windows and null on Unix. Sorry for the multiple runs! |
|
@Anshikakalpana unfortunately the failure still seems relevant. Can you please take a look? |
a28da0d to
5683e58
Compare
|
Still failing :( |
Fixes: nodejs#63461 Signed-off-by: Anshikakalpana <anshikajain196872@gmail.com>
5683e58 to
78160bf
Compare
|
Update: found the issue — assert.throws with a regex matches against the error message, not the code. Fixed both assertions to use { code: 'ERR_INVALID_ARG_VALUE' }. Latest push should be green. |
Fixes: #63461
Passing
'void'as a parameter type ingetFunctionorgetFunctionstriggers an internal assertion instead of a user-friendly error.In C,
voidin a parameter list means a function takes no arguments, expressed in Node.js FFI as an empty array[]. There is no valid use case for'void'as a parameter type.Fix:
add early validation in
getFunctionandgetFunctionsthat throwsERR_INVALID_ARG_VALUEwhen'void'appears in the parameters array, beforewrapWithSharedBufferis called.